<?php

defined('ACC') || exit('Access Denied');

class ManagerModel extends Model{
	
	/* 获取权限列表 */
	public function get_role_list(){
		$sql = 'select role_id, role_name, auth_list from role';
		return $this->db->getAll($sql);
	}
	
	/* 添加用户权限 */
	public function insert_admin_user($data){
		return $this->db->autoExecute($data, 'admin_user');
	}
	
	/* 获取所有管理员信息 */
	public function get_manager_list(){
		$sql = 'select user_id, username, email, add_time, last_login from admin_user';
		return $this->db->getAll($sql);
	}
	
	/* 删除一样管理员 */
	public function delete_admin_user($user_id){
		$sql = 'delete from admin_user where user_id = ' . $user_id;
		return $this->db->query($sql);
	}
	
	/* 获取一行管理员信息 */
	public function select_user_info($user_id){
		$sql = 'select user_id, username, email from admin_user where user_id =' . $user_id;
		return $this->db->getRow($sql);
	}
	
	/* 修改一行管理员信息 */
	public function update_user_info($data){
		return $this->db->autoExecute($data, 'admin_user', 'update', 'user_id='.$data['user_id']);
	}
	
}


?>